/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import de.javasoft.plaf.synthetica.SyntheticaStandardLookAndFeel;
import de.javasoft.plaf.synthetica.SyntheticaBlueSteelLookAndFeel;
import java.text.ParseException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Thomas
 */
public class LogIn_GUI extends javax.swing.JFrame {

    /**
     * Creates new form LogIn_GUI
     */
    public LogIn_GUI() {
        initComponents();
        this.setTitle("PV-LogIN");
        this.setSize(250, 200);
        this.setResizable(false);
        this.setLocationRelativeTo(null);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        tfBenutzer = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jPasswordField1 = new javax.swing.JPasswordField();
        jPanel3 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new java.awt.GridLayout(3, 1));

        jPanel1.setLayout(new java.awt.GridLayout(2, 0));

        jLabel1.setFont(new java.awt.Font("Batang", 0, 18)); // NOI18N
        jLabel1.setText("  Benutzer:");
        jPanel1.add(jLabel1);

        tfBenutzer.setFont(new java.awt.Font("Batang", 0, 18)); // NOI18N
        tfBenutzer.setText("admin");
        jPanel1.add(tfBenutzer);

        getContentPane().add(jPanel1);

        jPanel2.setLayout(new java.awt.GridLayout(2, 0));

        jLabel2.setFont(new java.awt.Font("Batang", 0, 18)); // NOI18N
        jLabel2.setText("  Password:");
        jPanel2.add(jLabel2);

        jPasswordField1.setFont(new java.awt.Font("Batang", 0, 18)); // NOI18N
        jPasswordField1.setText("jPasswordField1");
        jPanel2.add(jPasswordField1);

        getContentPane().add(jPanel2);

        jPanel3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jPanel3.setLayout(new java.awt.GridLayout(1, 0, 10, 10));

        jButton1.setFont(new java.awt.Font("Batang", 0, 18)); // NOI18N
        jButton1.setText("LogIn");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                onOk(evt);
            }
        });
        jPanel3.add(jButton1);

        jButton2.setFont(new java.awt.Font("Batang", 0, 18)); // NOI18N
        jButton2.setText("Beenden");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                onAbbrechen(evt);
            }
        });
        jPanel3.add(jButton2);

        getContentPane().add(jPanel3);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void onAbbrechen(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onAbbrechen
        dispose();
    }//GEN-LAST:event_onAbbrechen

    private void onOk(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onOk
        
        if(tfBenutzer.getText().equals("user"))
        {   
            SachbearbeiterDLG bd= new SachbearbeiterDLG(this);
            this.setVisible(false);
            bd.setVisible(true);
        }else if(tfBenutzer.getText().equals("admin"))
        {
            AdminDLG bd= new AdminDLG(this);
            this.setVisible(false);
            bd.setVisible(true);
        }
        else
        {
            SachbearbeiterDLG bd= new SachbearbeiterDLG(this);
            this.setVisible(false);
            bd.setVisible(true);
        }
        
    }//GEN-LAST:event_onOk

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(new SyntheticaBlueSteelLookAndFeel());
                    break;
                }
            }
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(LogIn_GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (ParseException ex) {
            Logger.getLogger(LogIn_GUI.class.getName()).log(Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new LogIn_GUI().setVisible(true);
            }
        });
    	
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPasswordField jPasswordField1;
    private javax.swing.JTextField tfBenutzer;
    // End of variables declaration//GEN-END:variables
}
